package net.spider.tasks.sankaku;

import java.io.FileInputStream;
import java.io.ObjectInputStream;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

import net.cl.utils.IOUtil;
import net.spider.dao.SankakuDao;
import net.spider.entity.ContentEntity;

public class StartUp {

	public static void init() {
		SankakuDao.init();
	}

	@SuppressWarnings("unchecked")
	public static BlockingQueue<ContentEntity> initTrunkQueue() {
		ObjectInputStream in = null;
		try {
			in = new ObjectInputStream(new FileInputStream("D:/workspace/eclipse/nethound/target/trunk.dat"));
			return (BlockingQueue<ContentEntity>) in.readObject();
		} catch (Exception e) {
			e.printStackTrace();
			return new LinkedBlockingQueue<ContentEntity>();
		} finally {
			IOUtil.closeQuietly(in);
		}
	}

}
